package jeconbond.experiment.market.resourcerelations;

import jeconbond.experiment.generate.ProfitableNormFormGenerateDecorator;
import jeconbond.experiment.market.generate.DefaultProfCostManagerFactory;
import jeconbond.experiment.market.resourcerelations.generate.AuditFlowProdAgentsCreator;
import jeconbond.experiment.market.resourcerelations.generate.BranchingProdAutomataGenerator;
import jeconbond.experiment.market.resourcerelations.generate.BrosnenEngineInitialiser;
import jeconbond.economic.resources.ResourceUtils;
import jeconbond.economic.systems.market.DefaultMarketRRSFactory;
import jeconbond.experiment.JEBExperimentFlow;
import jeconbond.experiment.ui.reportage.EconomicContextER2CConverter;
import laboratoryQ.experiment.settings.ReflectionBasedSettingsContainer;
import laboratoryQ.experiment.ui.reportage.ExperimentReportage;
import laboratoryQ.flatness.Point;

public class MainGoldereye {
	static { System.out.println("\nSMALL move 2 other package"); }
	static { System.out.println("\nSMALL manage packages"); }

	public static void main(String[] args) {
		JEBExperimentFlow experimentFlow = new JEBExperimentFlow();
		
		BrosnenExperimentSettings settings = 
			new BrosnenExperimentSettings();
		settings.initialise();
		
		settings.stepSize = 30;
		settings.stepCount = 50;
		settings.agentsCount = 80;
		settings.initMoney = 50.0;
		settings.initResourceExceedPercent = 1.2;
		
		settings.chainLength = 5;
		settings.branchesCount = 8;
		settings.postBranchCount = 4;
		
		settings.agentGreedPercent = 2.5;
		settings.produceProfit = 1.1;
		settings.concurrentPricePercent = 0.5;
		settings.observeCostsTraceLength = 10;
		
		settings.rrsFactory = new DefaultMarketRRSFactory();
		settings.resources = ResourceUtils.generateResources("r", 9);
		settings.experiment = experimentFlow; 
		settings.randomSeed = 0.0; 
		settings.zeroPoint = new Point(0.0, 0.0);
		
		settings.purchaseExceedDayBudget = -2.0;
		settings.purchaseExceedPassivePeriod = -2;
		settings.purchaseExceedUseTrackLength = -2;
		settings.utiliseExceedPeriod = -2;
		settings.selectPropositionsPart = -1;
		settings.feramonHistoryLength = -2;
		settings.antAgentCount = -2;
		settings.profitCostManagerFactory = new DefaultProfCostManagerFactory();
		settings.setCommoditiesDependGroupsPower(-2);
		settings.setCommoditiesDependGroups(null);
		settings.goalResourceIndex = -2;
		settings.timeStepX = -2;
		settings.speculantPropCountMarketPart = -2.0;
		settings.speculantGoalValueMarketPart = -2.0;
		settings.validate();

		ReflectionBasedSettingsContainer settingsContainer =
			new ReflectionBasedSettingsContainer(settings);
		settingsContainer.sortFields(
				"stepSize",
				"stepCount",
				"agentsCount",
				"chainLength",
				"produceProfit",
				"agentGreedPercent",
				"concurrentPricePercent",
				"initResourceExceedPercent",
				"initMoney",
				"observeCostsTraceLength",
				"randomSeed"
		);

		experimentFlow.automataGenerator = 
			new ProfitableNormFormGenerateDecorator(new BranchingProdAutomataGenerator());
		experimentFlow.agentCreator = new AuditFlowProdAgentsCreator(); 
		experimentFlow.engineInitialiser = new BrosnenEngineInitialiser();

		ExperimentReportage experimentReportage =
			ExperimentReportage.newExperiment2componentReportage(
					settingsContainer,
					new EconomicContextER2CConverter("GoldenEye audit strat and no more")
			);
		experimentReportage.showReportageFrame(args);
		
//		DiagramUtils.styleInsteadColor(moonrakerExpKit);
//
//		javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
//		fc.showSaveDialog(null);
//		java.io.File f = fc.getSelectedFile();
//		DiagramUtils.saveDiagrams(
//				moonrakerExpKit.getExperimentViewDrawers(),
//				experimentFlow,
//				f.getPath(),
//				3500, 2000
//				);
	}
}
